<ion-view title="请登录">

    <div particles class="auth-bg"></div>
    <ion-content class="auth" scroll="false">
        <div id="logo">
            <img src="img/logo-white.png">
             <h1 class="title">欢迎使用易联锁</h1>
             <p ng-if="error" class="text-center padding assertive-bg light">{{error}}</p>
        </div>
        <form ng-submit="doLogin(credentials)" name="loginForm" novalidate ng-show="doAction == 'login'">
            <ion-list class="alpha-dark">
                <label class="item item-input">
                    <i class="icon ion-person"></i>
                    <input type="text" name="username" maxlength="20" required placeholder="用户名/手机号码" ng-model="credentials.username">
                    <div class="ion-minus-circled" ng-show="loginForm.username.$dirty && loginForm.username.$invalid "></div>
                </label>
                <label class="item item-input">
                    <i class="icon ion-android-lock"></i>
                    <input type="password" name="password" placeholder="密码" ng-model="credentials.password">
                    <div class="ion-minus-circled" ng-show="loginForm.password.$dirty && loginForm.password.$invalid "></div>
                </label>
            </ion-list>

            <button class="button button-royal button-block expend" type="submit">登 陆</button>
            <div class="button-bar">
                <a ui-sref="app.pwreset" class="button button-clear button-block">忘记密码?</a>
                <a ng-click="doAction='signup'" class="button button-clear button-block">快速注册</a>
            </div>
            <div class="fixed-bottom text-center">
              <button class="button button-clear" type="button" ng-click="showSheet()">演示账号</button>
            </div>

        </form>

        <form name="signupForm" novalidate ng-show="doAction == 'signup'">
            <ion-list id="su-step1" class="alpha-dark" ng-show="step == 1">
                <label class="item item-input">
                    <i class="icon ion-key"></i>

                    <input type="text" name="cdkey" maxlength="16" required placeholder="请输入16位CDKEY或扫码" ng-model="signupData.cdkey">
                    <button class="button button-icon button-last icon ion-qr-scanner"></button>
                    <div class="ion-minus-circled" ng-show="signupForm.cdkey.$dirty && signupForm.cdkey.$invalid ">CDKEY无效</div>
                </label>
                <button class="button button-royal button-block expend" type="submit" ng-click="step1()">下一步</button>
            </ion-list>

            <ion-list id="su-step2" class="alpha-dark" ng-show="step == 2">
                <label class="item item-input">
                    <i class="icon ion-key"></i>
                    <input type="text" name="uname" maxlength="11" required placeholder="请输入手机号码" ng-model="signupData.cdkey">
                    <span class="ion-minus-circled" ng-show="signupForm.uname.$dirty && signupForm.uname.$invalid "></span>
                </label>
                <label class="item item-input">
                    <span class="icon ion-android-lock"></span>
                    <input type="password" placeholder="密码" ng-model="signupData.password">
                </label>
                <label class="item item-input">
                    <span class="icon ion-android-lock"></span>
                    <input type="password" placeholder="确认密码" ng-model="signupData.repassword">
                </label>
                <button class="button button-royal button-block expend" type="submit" ng-click="step2()">注 册</button>
            </ion-list>
            <button ng-click="doAction='login'" class="button button-clear button-block">返回登录</button>
        </form>

    </ion-content>
</ion-view>
